import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import type { ReactNode } from 'react'

import { ThemeLayout } from '@/components/ThemeLayout'

import { SITE_NAME } from '@/constants/seo.constants'

import './globals.scss'
import { Providers } from '@/app/providers'

const inter = Inter({
	subsets: ['latin', 'cyrillic']
})

export const metadata: Metadata = {
	title: {
		default: SITE_NAME,
		template: `%s | ${SITE_NAME}`
	},
	description: 'Simple CRM for private entrepreneurs'
}

export default function RootLayout({
	children
}: Readonly<{
	children: ReactNode
}>) {
	return (
		<html lang='ru'>
			<body className={inter.className}>
				<AppRouterCacheProvider>
					<Providers>
						<ThemeLayout>{children}</ThemeLayout>
					</Providers>
				</AppRouterCacheProvider>
			</body>
		</html>
	)
}
